<%-- 
    Document   : review
    Created on : May 4, 2011, 4:40:28 PM
    Author     : alexnewski
--%>

<%@page import="java.util.Date"%>
<%@page import="com.movie.Show"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Collections"%>
<%@page import="com.movie.Cinema"%>
<%@page import="com.movie.Movie"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@include file="headerv.html"%>

<jsp:useBean id="DaoShow" class="com.assg2.dao.DaoShow" />


<% Movie movie = (Movie) request.getAttribute("movie");
    List<Show> listshows = (List<Show>) request.getAttribute("listshows");
    Date exp = (Date) request.getAttribute("exp");
%>

<h3><%=movie.getTitle()%></h3>

<form method='POST' name='book' action='dispatcher?operation=book' onSubmit='return valFormBook()'>
    <center><table width='700px' border='0'>

            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    Time
                </td>
                <td>
                    Seats Available
                </td>
                <td>
                    Number of Seats
                </td>
            </tr>

            <%

                for (Show show : listshows) {

                    Date comb = show.CombineDateAndTime(exp);
                    out.println("<tr>");
                    out.println("<td>");
                    out.println("<INPUT type='radio' name='idshow' value='" + show.getIdshow() + "'>");
                    out.println("</td>");
                    out.println("<td>");
                    out.println(show.ShowTime());
                    out.println("</td>");
                    out.println("<td>");
                    out.println("<input type='hidden' name='numseatavailable" + show.getIdshow() + "' value='" + Integer.toString(DaoShow.SeatsAvailable(show, comb)) + "'size='15' />" + Integer.toString(DaoShow.SeatsAvailable(show, comb)));
                    out.println("</td>");
                    out.println("<td>");
                    out.println("<input type='text' name='numseatshow" + show.getIdshow() + "' size='15' />");
                    out.println("</td>");
                    out.println("</tr>");
                    out.println("<input type='hidden' name='datebook" + show.getIdshow() + "' value='" + comb.getTime() + "'size='15' />");
                }
            %>

        </table></center>
    <p>&nbsp;</p>
    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type='submit' value='Book' class='button'/></p>
</form>

<%@include file="footer.html"%>